package com.hmall.common.client;

import com.hmall.common.pojo.Item;
import com.hmall.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhiqw
 * @create 2022-10-29 1:40 AM
 */
@FeignClient(value = "itemservice")
@RequestMapping("/item")
public interface ItemClient {

    @GetMapping("/list")
    PageDTO<Item> page(@RequestParam Integer page, @RequestParam Integer size);

    @GetMapping("/{id}")
    Item findById(@PathVariable Long id);

    @PutMapping("/stock/{itemId}/{num}")
    void deductItemStock(@PathVariable("itemId") Long itemId, @PathVariable("num") Integer num);

    @GetMapping
    int getCount();
}
